package com.moblie.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.moblie.constant.MessageConstant;
import com.moblie.domain.ContentCategory;
import com.moblie.entity.Result;
import com.moblie.service.CategoryService;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/category")
@CrossOrigin(allowCredentials="true",allowedHeaders="*")
public class CategoryController {
    @Reference
    private CategoryService categoryService;
    @RequestMapping("/findAll")
    public Result findCategory(){
        try{
            List<ContentCategory> list=categoryService.findAll();
            return new Result(true, MessageConstant.FIND_CONTENTCATEGORY_SUCESS,list);
        }catch (Exception e){
            return new Result(false, MessageConstant.FIND_CONTENTCATEGORY_FAIL);
        }
    }
}
